import React from "react";
import "../css/Home.css";
import {Link,HashRouter,Route,Switch} from "react-router-dom";
import About from "./zu/About";
import Team from "./zu/Team";
import Culture from "./zu/Culture";
import Experience from "./zu/Experience";
import News from "./zu/News";
import Join from "./zu/Join";
import Between from "./zu/Between";
import Contact from "./zu/Contact";
export default class App extends React.Component{
  constructor(props){
    super(props);
    this.state = {
        list:['张一凡是个傻逼','真的假的','真的','他就是一个大撒比','+1','有品','小爱开放平台','企业团购','资质证照','协议规则','下载app','智能生活','Select Location'],
        user:[],
    }   
  }
  componentDidMount(){ 
    this.state.user.push(this.props.location.state);
    this.setState({
        user:this.state.user
    })
    console.log(this.state.user);
  }
  render(){
    return(
        <HashRouter>
      <div>
         <div className="home_container">
            <ul className="home_wrapper">
                {
                    this.state.list.map((element)=>{
                        return <li>
                            {element}
                        </li>
                    })
                }
            </ul>
            <div className="home_wrapper_right">
                <Link className="home_wrapper_content" to="/login">登录</Link>
                <div>注册</div>
                {
                    this.state.user.forEach((element)=>{
                        console.log(element)
                        return <div>
                                <div>{element}</div>
                            </div>
                    })
                }
            </div>
         </div>
         <div className="Home_list">
            <div><Link to="/about">公司简介</Link></div>
            <div><Link to="/team">管理团队</Link></div>
            <div><Link to="/culture">小米文化</Link></div>
            <div><Link to="/experience">发展经历</Link></div>
            <div><Link to="/news">小米新闻</Link></div>
            <div><Link to="/join">加入小米</Link></div>
            <div><Link to="/between">投资者关系</Link></div>
            <div><Link to="/contact">联系我们</Link></div>    
        </div>
        <div className="Home_list_to">
           <Switch>
           <Route path="/team" component={Team}/>
            <Route path="/culture" component={Culture}/>
            <Route path="/experience" component={Experience}/>
            <Route path="/news" component={News}/>
            <Route path="/join" component={Join}/>
            <Route path="/between" component={Between}/>
            <Route path="/contact" component={Contact}/>
            <Route path="/" component={About}/>
           </Switch>
        </div>
      </div>
      </HashRouter>
    )
  }
}
